package com.goldplusgold.live.channel;

import android.text.TextUtils;

import com.goldplusgold.live.bean.LMessageBean;
import com.goldplusgold.live.protobuf.ChatProto;
import com.goldplusgold.live.utils.UuidUtil;

import io.netty.channel.ChannelHandlerContext;
import io.netty.channel.ChannelInboundHandlerAdapter;

/**
 * Created by Administrator on 2017/7/13.
 */

public class LiveInboundHandler extends ChannelInboundHandlerAdapter {

    private  String roomId;
    public LiveInboundHandler(String roomId){
        this.roomId = roomId;
    }

    @Override
    public void channelActive(ChannelHandlerContext ctx) throws Exception {

        ChatProto.StepInParam stepInParam = ChatProto.StepInParam.newBuilder()
                .setRoomId(this.roomId)
                .build();

        ChatProto.ChatRequest request = ChatProto.ChatRequest.newBuilder()
                .setId(UuidUtil.uuidString())
                .setCmd(ChatProto.Cmd.STEP_IN)
                .setStepInParam(stepInParam)
                .build();
        ctx.channel().writeAndFlush(request);
        super.channelActive(ctx);
    }

}
